package com.xiongwei.mediator;

/**
 * @author XiongWei
 * @date 2024/2/1
 */
public class Alarm extends AbstractColleage{

    /**
     * 通过构造方法将中介类实例化到同事类中
     *
     * @param mediator
     * @param name
     */
    public Alarm(Mediator mediator, String name) {
        super(mediator, name);
        mediator.register(name, this);
    }

    @Override
    public void sendMessage(int stateChange) {
        getMediator().getMessage(stateChange, this.name);
    }

    public void sendAlarm(int stateChange) {
        sendMessage(stateChange);
    }
}
